package com.guopf.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 在读取配置文件信息的地方进行添加 @RefreshScope 注解
 */
@RestController
@RefreshScope
public class AppController {

    @Value("${userAge}")
    private String userAge;

    @GetMapping("/userAge")
    public String config(){
        System.out.println("userAge : " + userAge);
        return userAge;
    }
}
